Return to doc.sitecore.com

Valid for Sitecore 5.2, 5.1.1
  ChangeTemplate
Prev Next

ChangeTemplate replaces an item’s existing template definition.  The method returns True if the operation was successful, False otherwise.

bool ChangeTemplate(
  ItemDefinition item,
  TemplateChangeList changes,
  CallContext context
)

Sitecore calls the ChangeTemplate method when a user requests the change.  The method must change the item’s Template ID to templateID and transfer field data when possible (for instance, when the two templates have fields with the same name).  When the two templates share fields, the field IDs are changed, but the data is preserved.  Data associated with fields that exist in the original Template, but not in the new Template, should be discarded.


Prev Next